<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>设备列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <!--标准mui.css-->
    <link rel="stylesheet" href="../css/mui.min.css">
    <link rel="stylesheet" href="../css/iconfont.css" />
    <!--App自定义的css-->
    <link rel="stylesheet" type="text/css" href="../css/app.css"/>
    <link href="../css/mui.indexedlist.css" rel="stylesheet" />
    <style>
        * { touch-action: none; }
        html, body {
            height: 100%;
            overflow: hidden;
        }
        .mui-bar {
            -webkit-box-shadow: none;
            box-shadow: none;
        }
        .title{
            margin: 20px 15px 10px;
            color: #6d6d72;
            font-size: 15px;
        }
        body{
            background: #ffffff;
        }
        .oa-contact-cell.mui-table .mui-table-cell {
            padding: 11px 0;
            vertical-align: middle;
        }

        .oa-contact-cell {
            position: relative;
            margin: -11px 0;
        }

        .oa-contact-avatar {
            width: 75px;
        }
        .oa-contact-avatar img {
            border-radius: 50%;
        }
        .oa-contact-content {
            width: 100%;
        }
        .oa-contact-name {
            margin-right: 20px;
        }
        .oa-contact-name, oa-contact-position {
            float: left;
        }
        .mui-bar{
            background:#4F77AA ;
            color: #ffffff;
            -webkit-box-shadow: 0 0 1px rgba(0,0,0,0);
            box-shadow: 0 0 1px rgba(0,0,0,0);
        }
        .mui-title{
            color: #ffffff;
        }
        a{
            color:#ffffff;
        }
        .mui-content{
            background: #ffffff;
        }
        .content_item ul li .mui-pull-left{
            width: 80px;
            height: 80px;
            max-width: 80px;
            text-align: center;
            line-height: 80px;
            font-size: 16px;
            color: #ffffff;
        }

        .mui-content ul li a span{
            /*padding-right: 15px;*/
            /*color:#4F77AA ;*/
        }
        .mui-search input.seach{
            width: 70%;
            padding-left: 30px;
            margin: 0;
            border-radius: 50px 50px;
            font-size:14px;
        }
        .mui-search input.seach_button{
            width:80px;
            height:40px;
            color:#ffffff;
            background: #4F77AA;
            border-radius: 5px;
        }
        .mui-search{
            padding: 15px;
        }
        .mui-search i{
            font-size: 24px;
            position: absolute;
            left: 20px;
            margin-top:10px;
        }
        .mui-select{
            width: 33.33%;
            float: left;
        }
        .mui-select select{
            background: #EFEFF4;
            border-radius: 0;
        }
        .mui-select-content{
            width:100%;
            height:41px;
            background: #EFEFF4;
        }
        .mui-content{
            width:100%;
            height:100%;
        }
        .content_item{
            width:100%;
            height:calc(100% - 70px);
        }
        .content_item .mui-control-content{
            width:100%;
            height:100%;
        }
        .color-primary{
            color: #1ab394;
        }
        .color-success {
            color: #1c84c6;
        }
        .color-info {
            color: #23c6c8;
        }
        .color-warning {
            color: #f8ac59;
        }
        .color-finish{
            background:#09AE0A;
        }
        .color-run{
            background:#F8C217;
        }
        .color-unfinish{
            background:#54B5F8;
        }
        p.mui-ellipsis-title{
            font-size: 16px;
            /*font-weight:bold;*/
            color:#000000;
        }
    </style>
</head>

<body>
<header id="header" class="mui-bar mui-bar-nav">
    <span class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></span>
    <h1 class="mui-title">设备列表</h1>
    <!--<a href="query_equipment.html" class="mui-pull-right" style="font-size: 17px;margin-top:10px;">筛选</a>-->
</header>

<div class="mui-content">
    <div class="mui-search">
        <label><i class="icon iconfont icon-sousuo"></i></label><input class="seach" type="text" id="code_name"  placeholder="设备编码/设备名称"/>
        <input class="seach_button" type="button" onclick="search();" value="搜索">
        <!--<i class="mui-pull-right icon iconfont icon-saoyisao"  id="openscan"  style="font-size: 24px;margin-top:10px;"></i>-->
    </div>
    <div class="content_item">
        <div id="item1" class="mui-control-content mui-active">
            <div id="scroll" class="mui-scroll-wrapper">
                <div class="mui-scroll">
                    <ul id="device" class="mui-table-view">
                        <!--图标是图-->
                        <!--<li class="mui-table-view-cell mui-media" onclick="choiceEquipment(0)">
                            <img class="mui-media-object mui-pull-left" src="../img/dianti.jpg">
                            <div class="mui-media-body">
                                <p class='mui-ellipsis mui-ellipsis-title'>电梯(HVB-001)</p>
                                <p class='mui-ellipsis'>使用部门：</p>
                                <p class='mui-ellipsis'>设备位置：一车间A排</p>
                            </div>
                        </li>
                        <li class="mui-table-view-cell mui-media" onclick="choiceEquipment(1)">
                            <img class="mui-media-object mui-pull-left" src="../img/dianti.jpg">
                            <div class="mui-media-body">
                                <p class='mui-ellipsis mui-ellipsis-title'>电梯(HVB-002)</p>
                                <p class='mui-ellipsis'>使用部门：</p>
                                <p class='mui-ellipsis'>设备位置：一车间A排</p>
                            </div>
                        </li>

                        <li class="mui-table-view-cell mui-media" onclick="choiceEquipment(2)">
                            <img class="mui-media-object mui-pull-left" src="../img/dianti.jpg">
                            <div class="mui-media-body">
                                <p class='mui-ellipsis mui-ellipsis-title'>电梯(HVB-003)</p>
                                <p class='mui-ellipsis'>使用部门：</p>
                                <p class='mui-ellipsis'>设备位置：一车间A排</p>
                            </div>
                        </li>

                        <li class="mui-table-view-cell mui-media" onclick="choiceEquipment(3)">
                            <img class="mui-media-object mui-pull-left" src="../img/dianti.jpg">
                            <div class="mui-media-body">
                                <p class='mui-ellipsis mui-ellipsis-title'>电梯(HVB-004)</p>
                                <p class='mui-ellipsis'>使用部门：</p>
                                <p class='mui-ellipsis'>设备位置：一车间A排</p>
                            </div>
                        </li>

                        <li class="mui-table-view-cell mui-media" onclick="choiceEquipment(4)">
                            <img class="mui-media-object mui-pull-left" src="../img/dianti.jpg">
                            <div class="mui-media-body">
                                <p class='mui-ellipsis mui-ellipsis-title'>电梯(HVB-005)</p>
                                <p class='mui-ellipsis'>使用部门：</p>
                                <p class='mui-ellipsis'>设备位置：一车间A排</p>
                            </div>
                        </li>
                        <li class="mui-table-view-cell mui-media" onclick="choiceEquipment(5)">
                            <img class="mui-media-object mui-pull-left" src="../img/dianti.jpg">
                            <div class="mui-media-body">
                                <p class='mui-ellipsis mui-ellipsis-title'>电梯(HVB-006)</p>
                                <p class='mui-ellipsis'>使用部门：</p>
                                <p class='mui-ellipsis'>设备位置：一车间A排</p>
                            </div>
                        </li>

                        <li class="mui-table-view-cell mui-media" onclick="choiceEquipment(6)">
                            <img class="mui-media-object mui-pull-left" src="../img/dianti.jpg">
                            <div class="mui-media-body">
                                <p class='mui-ellipsis mui-ellipsis-title'>电梯(HVB-007)</p>
                                <p class='mui-ellipsis'>使用部门：</p>
                                <p class='mui-ellipsis'>设备位置：一车间A排</p>
                            </div>
                        </li>

                        <li class="mui-table-view-cell mui-media" onclick="choiceEquipment(7)">
                            <img class="mui-media-object mui-pull-left" src="../img/dianti.jpg">
                            <div class="mui-media-body">
                                <p class='mui-ellipsis mui-ellipsis-title'>电梯(HVB-008)</p>
                                <p class='mui-ellipsis'>使用部门：</p>
                                <p class='mui-ellipsis'>设备位置：一车间A排</p>
                            </div>
                        </li>-->

                    </ul>
                </div>
            </div>
        </div>
    </div>

</div>

</body>
<script type="text/javascript" src="../js/jquery-1.11.3.js"></script>
<script type="text/javascript" src="../js/mui.picker.min.js"></script>
<script type="text/javascript" src="../js/mui.js"></script>
<script type="text/javascript" src="../../script/api.js"></script>


<script type="text/javascript" charset="utf-8">
    mui.init();
    mui('body').on('tap','a',function(){
        window.top.location.href=this.href;
    });
    (function($) {
        $('#scroll').scroll({
            indicators: true //是否显示滚动条
        });
        var segmentedControl = document.getElementById('segmentedControl');
        $('.mui-input-group').on('change', 'input', function() {
            if (this.checked) {
                var styleEl = document.querySelector('input[name="style"]:checked');
                var colorEl = document.querySelector('input[name="color"]:checked');
                if (styleEl && colorEl) {
                    var style = styleEl.value;
                    var color = colorEl.value;
                    segmentedControl.className = 'mui-segmented-control' + (style ? (' mui-segmented-control-' + style) : '') + ' mui-segmented-control-' + color;
                }
            }
        });
    })(mui);
    // window.onload=function(){
    //     var openscan=document.getElementById("openscan");
    //     openscan.onclick=function(){
    //         openScan();
    //     }
    // }
    // //打开
    // function openScan(){
    //
    //     var FNScanner = api.require('FNScanner');
    //     FNScanner.open({
    //         autorotation: true,
    //         sound:"widget://res/scan.wav"
    //     }, function(ret, err) {
    //         if (ret) {
    //             // alert(JSON.stringify(ret));
    //             if('success' == ret.eventType){
    //                 var content=ret.content;
    //                 if(content.indexOf("http://")==0 || content.indexOf("https://")==0 || content.indexOf("/sys")==0){
    //                     // window.location.href=content;
    //                     window.location.href="../../public/saoyisao.html?ret="+JSON.stringify(ret);
    //                 }else{
    //                     alert(content);
    //                 }
    //             }
    //
    //         } else {
    //             alert(err.msg);
    //         }
    //     });
    // }
    $(document).on("click","span.mui-pull-left",function(){
        window.location.href="add_repair.html";
    })
    
    function choiceEquipment(i) {
    
    //	window.parent.document.getElementById("deviceCode1").val("123");
        window.location.href="add_repair.html";
    }
    
    window.onload=function(){
			alert("22323");
		//加载所有设备
		device();
	}
    //加载所有设备
    function device(){
    alert("111");
    	$.ajax({
			url:ctx+'/sys/patrol/App/AppDeviceRepair/AppDevice',
			type:"get",
			dataType:"json",
			success:function(datas){
    			
    			for(var i=0;i<datas.length;i++){
    				var html='<li class="mui-table-view-cell mui-media" onclick="choiceEquipment('+i+')">';
    					html+='<div class="mui-media-body">';
    					html+='<p id="deviceCode_'+i'" class="mui-ellipsis mui-ellipsis-title">设备编码:'+datas[i].code+'</p>';
    					html+='<p id="deviceName_'+i'" class="mui-ellipsis">设备名称：'+datas[i].name+'</p>';
    					html+='<p id="specifications_'+i'" class="mui-ellipsis">设备规格：'+datas[i].specifications+'</p>';
    					html+='<p id="deviceSpace_'+i'" class="mui-ellipsis">设备位置：'+datas[i].space+'</p>';
    					html+='<p id="manufacturer_'+i'" class="mui-ellipsis">设备厂商：'+datas[i].manufacturer+'</p>';
    					html+='</div>';
    					html+='</li>';
    				$("#device").append(html);
    	
    			}
    	
    		}
    	
    	});
    
    }
    
    //根据编码和名称搜索
    function search(){
    	$("#device").html("");
    	var code_name=$("#code_name").val();
    	alert(code_name);
    	$.ajax({
			url:ctx+'/sys/patrol/App/AppDeviceRepair/getCode_name?code_name='+code_name,
			type:"get",
			dataType:"json",
			success:function(datas){
    			
    			for(var i=0;i<datas.length;i++){
    				var html='<li class="mui-table-view-cell mui-media" onclick="choiceEquipment('+i+')">';
    					html+='<div class="mui-media-body">';
    					html+='<p id="deviceCode_'+i'" class="mui-ellipsis mui-ellipsis-title">设备编码:'+datas[i].code+'</p>';
    					html+='<p id="deviceName_'+i'" class="mui-ellipsis">设备名称：'+datas[i].name+'</p>';
    					html+='<p id="specifications_'+i'" class="mui-ellipsis">设备规格：'+datas[i].specifications+'</p>';
    					html+='<p id="deviceSpace_'+i'" class="mui-ellipsis">设备位置：'+datas[i].space+'</p>';
    					html+='<p id="manufacturer_'+i'" class="mui-ellipsis">设备厂商：'+datas[i].manufacturer+'</p>';
    					html+='</div>';
    					html+='</li>';
    				$("#device").append(html);
    	
    			}
    	
    		}
    	
    	})
    
    }
    
</script>
</html>